/**
 * 
 */
package menuMaster;
//import java.awt.Component;
//import java.awt.Container;
//import java.awt.event.ActionEvent;
//import java.awt.event.ActionListener;

import javax.swing.JMenuBar;
import javax.swing.JToolBar;
import actionHandlers.*;

import cookxml.cookswing.*;

/**
 * @author Bradford
 *
 */
public class MenuBuilder {
	public final static int BUILDMENUBAR = 0;
	public final static int BUILDTOOLBAR = 1;  
	private String myFileName;
	private JMenuBar myMenuBar;
	private JToolBar myToolBar;
	private ActionMaster myActionMaster;
	private int myMode;
	
	public MenuBuilder(String fileName)
	{
		myMode = 0;
		myActionMaster = new ActionMaster();
		CookSwing cookSwing = new CookSwing(myActionMaster);
		myFileName = fileName;
		myMenuBar = (JMenuBar) cookSwing.render(fileName);
	}
	public MenuBuilder(String fileName, int mode) // TODO: Don't use control flags
	{
		myActionMaster = new ActionMaster();
		CookSwing cookSwing = new CookSwing(myActionMaster);
		myFileName = fileName;
		myMode = mode;
		switch (myMode)
		{
		case BUILDMENUBAR: // menubar
			myMenuBar = (JMenuBar) cookSwing.render(fileName);
			myToolBar = null;
			break;
		case BUILDTOOLBAR: // toolbar
			myMenuBar = null;
			myToolBar = (JToolBar) cookSwing.render(fileName);
			break;
		}
	}
	
	public JMenuBar getMenuBar() { return myMenuBar; }
	public JToolBar getToolBar() { return myToolBar; }
	public String getFileName()  { return myFileName; }
}
